﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
namespace DAO
{
    public class TacGiaDAO
    {
        public static void Them(TacGiaDTO tg)
        {
            string str;
            str="insert into TacGia(TenTacGia) values('"+tg._tenTacGia+"')";
            DataProvider.ExecNonQuery(str);
        }
        public static DataTable LayDSTacGia()
        {
            string str;
            DataTable dt = new DataTable();
            str = "select MaTacGia,TenTacGia from TacGia where isDel=0";
            dt= DataProvider.ExecQuery(str);
            return dt;
        }

        public static void Xoa(TacGiaDTO tg)
        {
            string str;
            str = "update TacGia set isDel='"+1+"' where MaTacGia="+tg._maTacGia+"";
            DataProvider.ExecNonQuery(str);
        }
        public static void Sua(TacGiaDTO tg)
        {
            string str;
            str = "update TacGia set TenTacGia='" +tg._tenTacGia+ "' where MaTacGia=" + tg._maTacGia + "";
            DataProvider.ExecNonQuery(str);
        }

    }
}
